//
//  EJRefreshNormalHeader.m
//  IOSParents
//
//  Created by Lius on 2017/4/1.
//  Copyright © 2017年 ejiang. All rights reserved.
//

#import "EJRefreshNormalHeader.h"

@implementation EJRefreshNormalHeader

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

+ (EJRefreshNormalHeader *)ej_refreshNormalHeaderWithTarget:(id)target refreshingAction:(SEL)action {
    EJRefreshNormalHeader *header = [EJRefreshNormalHeader headerWithRefreshingTarget:target refreshingAction:action];
    
    UIColor * color = nil;
    if (@available(iOS 13.0, *)) {
        color = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
            if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark) {
                return [UIColor colorWithRed:(102.0 / 255) green:(102.0 / 255) blue:(102.0 / 255) alpha:1];
            } else {
                return [UIColor colorWithRed:(155.0 / 255) green:(155.0 / 255) blue:(155.0 / 255) alpha:1];
            }
        }];
    } else {
        // Fallback on earlier versions
        color = [UIColor colorWithRed:(155.0 / 255) green:(155.0 / 255) blue:(155.0 / 255) alpha:1];
    }
    
    header.stateLabel.textColor = color;
    header.lastUpdatedTimeLabel.textColor = color;
    
    UIFont *font = [UIFont fontWithName:@"PingFangSC-Regular" size:13];
    if (font == nil) {
        if (@available(iOS 8.2, *)) {
            font = [UIFont systemFontOfSize:13 weight:UIFontWeightRegular];
        } else {
            font = [UIFont systemFontOfSize:13];
        }
    }
    header.stateLabel.font = font;
    header.lastUpdatedTimeLabel.font = font;
    
    return header;
}

@end
